package config

import (
	toolsdatabase "gitee.com/daofeixian/dfx_golang_toolset/databases"
	toolsnosql "gitee.com/daofeixian/dfx_golang_toolset/nosqls"
	"github.com/zeromicro/go-zero/zrpc"
)

type Config struct {
	zrpc.RpcServerConf
	DBAUTO          bool                     `json:"db_autoMigrate"`
	DatabasesConfig []toolsdatabase.Database `json:"databases_config"`
	RedisConfig     []toolsnosql.RedisConfig `json:"redis_config"`
	XxlJobAdmin     XxlJobAdmin              `json:"xxl-job-admin"`
	Ipblacklist     Ipblacklist              `json:"ipblacklist"`
}

type Ipblacklist struct {
	Timeout  int `json:"timeout"`
	MaxIpNum int `json:"max_ip_num"`
}

type XxlJobAdmin struct {
	URL            string         `json:"url"`
	Token          string         `json:"token"`
	RegisterKey    string         `json:"register_key"`
	XxlJobExecutor XxlJobExecutor `json:"xxl-job_executor"`
}

type XxlJobExecutor struct {
	Port            int    `json:"port"`
	LoopbackAddress string `json:"loopback_addr"`
	Listen          string `json:"listen"`
	Uri             string `json:"uri"`
}
